package com.legsem.legstar.cci;

import java.util.Map;

import javax.resource.ResourceException;
import javax.resource.cci.Interaction;

/**
 * LegStar interactions with the mainframe implements these methods instead of
 * the regular "Record" oriented methods.
 * 
 */
public interface LegStarInteraction extends Interaction {

    /**
     * Interact with the mainframe using the interaction specifications
     * provided.
     * <p/>
     * In this case the mainframe is expecting a single input structure and
     * produces a single output structure.
     * 
     * @param ispec describes the interaction (program name, etc....)
     * @param input the JAXB object mapping to the mainframe program input
     *            structure
     * @return the JAXB object mapping to the mainframe program output structure
     * @throws ResourceException if interaction fails
     */
    public Object execute(LegStarSingleIOInteractionSpec ispec, Object input)
            throws ResourceException;

    /**
     * Interact with the mainframe using the interaction specifications
     * provided.
     * <p/>
     * In this case the mainframe is expecting multiple input structures and
     * produces multiple output structures.
     * 
     * @param ispec describes the interaction (program name, etc....)
     * @param input a map of JAXB objects mapping to named mainframe input
     *            structures
     * @return a map of JAXB objects mapping to named mainframe output
     *         structures
     * @throws ResourceException if interaction fails
     */
    public Map < String, Object > execute(LegStarMultiIOInteractionSpec ispec,
            Map < String, Object > input) throws ResourceException;
}
